package org.lisen.patterndemo.observer.v01;

import java.util.ArrayList;
import java.util.List;

public class Patient {

    private List<Observer> observers = new ArrayList<>();

    public void addObserver(Observer observer) {
        observers.add(observer);
    }

    public void ringBell() {
        BellEvent event = new BellEvent(this);
        for (Observer observer: observers) {
            observer.bell(event);
        }
    }

}
